import { useNavigate } from "react-router-dom";

type DocumentItemProps = {
  doc: {
    id: string;
    title: string;
    createdAt: string;
  };
};

export function DocumentItem({ doc }: DocumentItemProps) {
  const navigate = useNavigate();

  return (
    <div
      className="flex flex-col p-[20px] border-[2px] border-red-500 cursor-pointer"
      onClick={() => {
        navigate(`/doc/${doc.id}`);
      }}
    >
      <div>{doc.title}</div>
      <div>{doc.createdAt}</div>
    </div>
  );
}
